package com.spring.aop;

import org.aspectj.lang.ProceedingJoinPoint;

public class TestAspect {
	
	//执行方法之前
	public void doBefore() {
		System.out.println("开始之前");
	}
	
	//环绕通知
	public Object doAround(ProceedingJoinPoint pjp) throws Throwable {
		System.out.println("环绕之前");
		Object proceed = pjp.proceed();//目标方法
		System.out.println("环绕之后");
		return proceed;
	}
	
	//
	public void doAfterRunning() {
		System.out.println("方法执行之后（发生异常不会调用）");
	}
	
	//出现异常调用
	public void doAfterException() {
		System.out.println("出现异常了");
	}
	
	//执行方法之后
	public void doAfter() {
		System.out.println("之后（出现异常也会调用）");
	}
	
}
